package FIT::Document::Handler::Attempt;

use FIT::Class;
use FIT::Document::Transformer;

extends 'FIT::Document::Handler::Base';

sub handle {
    my ($fixture, $element, @handlers) = @_;
    attempt
        { $self->run_next_handler($fixture, $element, @handlers) }
        $element;
}


=head1 NAME

FIT::Document::Handler::Attempt - swalow and report errors in the element where they occured


=head1 DESCRIPTION

The FIT way of handling errors is to report them and continue testing. They are
reported in the element whose handling caused them. In a cell if it is a cell,
or in the first cell if it is not.

This handler makes sure that errors in C<do_cell()> are reported inside the
cell being handled, C<do_table()> in the 1st cell in the table, and C<do_row()>
in the 1st cell in the row.

=cut

